package com.ocom.payconfig.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ocom.common.entity.payconfig.EntityXfDiscountConfig;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface IDaoXfDiscountConfig extends BaseMapper<EntityXfDiscountConfig> {

	@Select({"<script>",
			"select \n" +
					"c.*,m.merch_name \n" +
					"from xf_discount_config c \n" +
					"left join   xf_merchant_info m    on    m.merch_id=c.merch_id   \n" +
					"where c.com_id = #{comId}  "+
					"<when test=\"accountType !=null and  accountType >=0\" > "+
					" and  c.acc_type_id = #{accountType}  "+
					" </when> "+
					"<when test=\"consTimeZone !=null and  consTimeZone >=0\" > "+
					" and  c.cons_time_zone = #{consTimeZone}  "+
					" </when> "+
					" order by c.acc_type_id, c.cons_type, c.meal_no, c.cons_times  " +
					"</script>"})
	public List<EntityXfDiscountConfig> discountConfigList(@Param("comId")Long comId,
											 @Param("accountType")Integer accountType,
											 @Param("consTimeZone") Integer consTimeZone);


}
